package cn.jw.framework.test;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import cn.jw.starter.web.common.FastJsonHttpMessageConverterFactory;
import cn.jw.starter.web.core.interceptors.RequestLogInterceptor;

/**
 * 自动配置
 *
 * @author wgslucky
 * @since 2024/5/1 22:34
 **/
@Configuration
public class GameServerAutoConfiguration implements WebMvcConfigurer {

    private Logger logger = LoggerFactory.getLogger(GameServerAutoConfiguration.class);

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new RequestLogInterceptor()).addPathPatterns("/**");
    }

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        FastJsonHttpMessageConverterFactory.addHttpMessageConverter(converters);
    }
}
